//
//  rnd.c
//  reli_udp
//
//  Created by Eric Sun on 11/20/12.
//  Copyright (c) 2012 Eric Sun. All rights reserved.
//

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

double rnd() {
	double n = rand() / (double)RAND_MAX;
	n = rand() / (double)RAND_MAX;
	return n;
}

bool corrupted(double Pc) {
	double n = rnd();
	//printf("%f\n", n);
	if (Pc > n)
		return true;
	else return false;
}

bool lost(double Pl) {
	double n = rnd();
	//printf("%f\n", n);
	if (Pl > n)
		return true;
	else return false;
}